<script type="text/javascript">
    var counter = 1;
    var limit = 10;
    <?php $photoCounter = 0; ?>
    function addInput(){
         if (counter == limit)  {
              alert("You have reached the limit of adding " + counter + " inputs");
         }
         else {
              var newdiv = document.createElement('div');
              newdiv.innerHTML = "Entry " + (counter + 1) + 
              " <br><input type='file' name='data[Admin][foto" + (counter + 1) + "]'>";
              document.getElementById('form_main').appendChild(newdiv);
              counter++;
              <?php $photoCounter++; ?>
         }
    }
</script>

<div class="square">
<h1>Voeg nieuwsitem toe</h1>
    <?php
        echo $this->Form->create('Admin', array('action' => 'addNewsItem', 'type' => 'file'));
    ?>
        <div id="form_main">
    <?php
        echo $this->Form->input('datum');
        echo $this->Form->input('titel');
        echo $this->Form->input('content', array('rows' => '3'));
        echo $this->Form->button('add', array('type' => 'button', 'onClick' => 'addInput();'));
        echo $this->Form->input('foto1', array('type' => 'file'));
    ?>
    </div>
    <div id="form_submit">
    <?php 
        echo $this->Form->input('Save item',array('type' => 'submit'));
    ?>
    </div>
</div>